#include <bits/stdc++.h>

using namespace std;

typedef unsigned int R;
const int MAXN = 1e5+10;
const R inf = -1;
typedef struct {int v,nxt;}edge;

int dfn[MAXN],top[MAXN],h[MAXN],fa[MAXN],siz[MAXN],son[MAXN],dep[MAXN];
int n,m,cap,cnt,tot,ind[MAXN];
R a[MAXN],val[MAXN<<2],lz[MAXN<<2];
edge e[MAXN<<1];

void link(int x,int y){e[++cnt] = (edge){y,h[x]};h[x] = cnt;}

void pushdown(int o){
	if(lz[o] < inf){
		val[o<<1] = lz[o];
		val[o<<1|1] = lz[o];
		lz[o<<1] = lz[o];
		lz[o<<1|1] = lz[o];
		lz[o] = inf;
	}
}

void upd(int xl,int xr,R v,int o = 1,int l = 1,int r = n){
	if(xl == l && xr == r){
		val[o] = v;
		lz[o] = v;
		return;
	}
	pushdown(o);
	int mid = (l+r)>>1;
	if(xr <= mid) upd(xl,xr,v,o<<1,l,mid);
	else if(xl > mid) upd(xl,xr,v,o<<1|1,mid+1,r);
	else upd(xl,mid,v,o<<1,l,mid),upd(mid+1,xr,v,o<<1|1,mid+1,r);
	val[o] = min(val[o<<1],val[o<<1|1]);
}

R query(int xl,int xr,int o = 1,int l = 1,int r = n){
	if(xl == l && xr == r) return val[o];
	int mid = (l+r)>>1;
	pushdown(o);
	if(xr <= mid) return query(xl,xr,o<<1,l,mid);
	else if(xl > mid) return query(xl,xr,o<<1|1,mid+1,r);
	else return min(query(xl,mid,o<<1,l,mid),query(mid+1,xr,o<<1|1,mid+1,r));
}		 

void dfs(int x,int p){
	fa[x] = p ,dep[x] = dep[p]+1,siz[x] = 1;
	for(int i = h[x];i;i = e[i].nxt){
		int y = e[i].v;
		if(y == p) continue;
		dfs(y,x);
		siz[x] += siz[y];
		if(siz[son[x]] < siz[y]) son[x] = y;
	}
}

void dfs1(int x,int anc){
	top[x] = anc; dfn[x] = ++tot; ind[dfn[x]] = x;
	upd(dfn[x],dfn[x],a[x]);
	if(son[x]) dfs1(son[x],anc);
	for(int i = h[x];i;i = e[i].nxt){
		int y = e[i].v;
		if(y == fa[x] || y == son[x]) continue;
		dfs1(y,y);
	}
}

void modify(int x,int y,R v){
	while(top[x] != top[y]){
		if(dep[top[x]] < dep[top[y]]) swap(x,y);
		upd(dfn[top[x]],dfn[x],v);
		x = fa[top[x]];
	}
	if(dfn[x] > dfn[y]) swap(x,y);
	upd(dfn[x],dfn[y],v);
}

int GO(int x,int y){
	while(fa[top[y]] != x && top[y] != top[x]){
		y = fa[top[y]];
	}
	if(top[x] == top[y]) return ind[dfn[x] + 1];
	else return top[y];
}
	
int main(){
	scanf("%d %d",&n,&m);
	for(int i = 1;i < MAXN;i++) lz[i] = inf;
	for(int i = 1;i < n;i++){
		int x,y;scanf("%d %d",&x,&y);
		link(x,y);link(y,x);
	}
	for(int i = 1;i <= n;i++) scanf("%u",&a[i]);
	scanf("%d",&cap);
	dfs(cap,0); dfs1(cap,cap);
	while(m--){
		int op,id,x,y;R z;
		scanf("%d",&op);
		if(op == 1){
			scanf("%d",&id);
			cap = id;
		}else if(op == 2){
			scanf("%d %d %u",&x,&y,&z);
			modify(x,y,z);
		}else {
			R ans = inf;
			scanf("%d",&id);
			if(dfn[cap] < dfn[id] || dfn[cap] > dfn[id] + siz[id] - 1){
				ans = query(dfn[id],dfn[id] + siz[id]-1);
			}else if(cap == id){
				ans = val[1];
			}else {
				int t = GO(id,cap);
				if(dfn[t] > 1) ans = query(1,dfn[t]-1);
				if(dfn[t] + siz[t] - 1 < n)  ans = min(ans,query(dfn[t]+siz[t],n));
			}
			printf("%u\n",ans);
		}
	}
	return 0;
}
